- name: Active le mode maintenance # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: './console maintenance:mode --on' args: chdir: "{{ nextcloud_webroot }}" - name: Update nextcloud root dir symbolic link become: true ansible.builtin.file: src: "../../../nextcloud/sources/nextcloud-{{ ancienne_version }}" dest: "{{ nextcloud_webroot }}/nextcloud" owner: nextcloud group: nextcloud state: link follow: false - name: Update nextcloud common app dir symbolic link become: true ansible.builtin.file: src: "../../../nextcloud/sources/nextcloud-{{ ancienne_version }}" dest: "{{ nextcloud_webroot }}/common" owner: nextcloud group: nextcloud state: link follow: false - name: "[PostgreSQL] - {{ nextcloud_db_name }} database is created." become_user: postgres become: true community.postgresql.postgresql_db: name: "{{ nextcloud_db_name }}" state: "{{ item }}" owner: "{{ nextcloud_php_user }}" target: "/tmp/{{ nextcloud_db_name }}.pgc" target_opts: "-F c" loop: - absent - present - restore - name: Pour chaque base, ajouter les droits suivants à l'utilisateur php become_user: postgres become: true community.postgresql.postgresql_privs: db: "{{ item.db }}" privs: "{{ item.privs }}" type: "{{ item.type |default(omit) }}" objs: "{{ item.objs }}" role: "{{ item.role }}" grant_option: "{{ item.grant_option |default(omit) }}" loop_control: label: "{{ item.name }}" loop: - db: "{{ nextcloud_db_name }}" privs: "ALL" type: "schema" objs: "public" role: "{{ nextcloud_php_user }}" grant_option: true name: "GRANT ALL ON SCHEMA public TO php_{{ SIGLE }}_nuage WITH GRANT OPTION;" - name: Copy nextcloud config file become: true ansible.builtin.copy: src: "{{ nextcloud_webroot }}/config/config.php.bak" dest: "{{ nextcloud_webroot }}/config/config.php" remote_src: true # because the src is already on the remote host owner: "{{ nextcloud_php_user }}" group: "{{ nextcloud_websrv_user }}" mode: '640' - name: Desactive le mode maintenance # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: './console maintenance:mode --off' args: chdir: "{{ nextcloud_webroot }}" - name: Run nextcloud upgrade script # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: ./console upgrade args: chdir: "{{ nextcloud_webroot }}" register: nc_upgrade_result - name: Obtenir la version actuelle # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: '{{ nextcloud_webroot }}/console status --output=json' register: result - name: afficher la version actuelle ansible.builtin.debug: msg: "La version restaurée est {{ tmp.versionstring }}" vars: tmp: "{{ result.stdout | from_json }}"